This sample code shows the use of DatabaseTables Collection. Modify the following sample code to fit your needs.
Private Sub Command1_Click()
On Error GoTo Command1_Click_Error
Dim crystalApplication As CRPEAuto.Application
Dim crystalReport As CRPEAuto.Report
Dim db As CRPEAuto.Database
Dim dbtables As CRPEAuto.DatabaseTables
Dim dbTable as CRPEAuto.DatabaseTable
Set crystalApplication = CreateObject("Crystal.CRPE.Application")
Set crystalReport = crystalApplication.OpenReport _
("d:\crw\reports\craze\wwsales.rpt")
Set db = crystalReport.Database
Set dbtables = db.Tables
MsgBox "Number of tables : " & dbtables.Count
Command1_Click_Exit:
Exit Sub
Command1_Click_Error:
If crystalApplication Is Nothing Then
MsgBox "Unable to CreateObject(""Crystal.CRPE.Application"")"
GoTo Command1_Click_Exit
End If
If crystalReport Is Nothing Then
MsgBox "Unable to OpenReport(""d:\crw\reports\craze\wwsales.rpt"")"
GoTo Command1_Click_Exit
End If
MsgBox "Unknown error in Command1_Click routine"
GoTo Command1_Click_Exit
End Sub
Seagate Software IMG Holdings, Inc. http://www.seagatesoftware.com Support services: http://support.seagatesoftware.com |